package org.glut.backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.glut.backend.domain.Comment;

import java.util.List;

/**
* 评论表 Mapper
*
* @author fengyue
* @since 2025-08-05 15:14
*/
@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    // 自定义查询：根据目标ID查询评论（包含子评论）
    @Select("SELECT * FROM comment WHERE target_id = #{targetId} ORDER BY create_time ASC")
    List<Comment> selectByTargetId(Long targetId);

}
